package BinaryTree;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 殇
 * Date: 2025-07-27
 * Time: 15:45
 */
public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree();

        binaryTree.preOrder(root);
        System.out.println();
        binaryTree.inOrder(root);
        System.out.println();
        binaryTree.postOrder(root);
        System.out.println();
        System.out.println("===节点个数：===");
        binaryTree.size(root);
        System.out.println(binaryTree.nodeSize);
        System.out.println("===节点个数2：===");
        System.out.println(binaryTree.size2(root));
        System.out.println("===叶子节点个数1：===");
        binaryTree.getLeafNodeCount1(root);
        System.out.println(binaryTree.leafSize);
        System.out.println("===叶子节点个数2：===");
        binaryTree.getLeafNodeCount2(root);
        System.out.println(binaryTree.leafSize);
        System.out.println("第K层的节点个数：");
        System.out.println(binaryTree.getKLevelNodeCount(root,3));
        System.out.println("======高度：=======");
        System.out.println(binaryTree.getHeight(root));
        System.out.println("======判断val是否存在：=======");
        System.out.println(binaryTree.find(root,'0'));
        System.out.println(binaryTree.find(root,'B'));
        System.out.println("======层序遍历：=======");
        binaryTree.levelOrder(root);
    }
}
